package com.ruoyi.expressList.controller;

import cn.jy.common.index.Member;
import com.ruoyi.expressList.domain.ExpressAuth;
import com.ruoyi.expressList.domain.ExpressList;
import com.github.pagehelper.PageInfo;
import com.ruoyi.expressList.domain.ExpressDetial;
import com.ruoyi.expressList.service.IExpressListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.web.controller.BaseController;


@RestController
@RequestMapping("/expressList")
@CrossOrigin
public class ExpressListController extends BaseController
{
    @Autowired
    private IExpressListService expressListService;

    //快递员展示
    @GetMapping("/list")
    public PageInfo<ExpressDetial> list(ExpressDetial expressList)
    {
        return expressListService.selectExpressListList(expressList);
    }
    //普通会员
    @GetMapping("/listMember")
    public PageInfo<ExpressDetial> listMember(ExpressDetial expressList)
    {
        return expressListService.selectExpressListListMember(expressList);
    }
    @GetMapping("/authList")
    public PageInfo<ExpressAuth> authList(ExpressAuth expressAuth)
    {
        return expressListService.authList(expressAuth);
    }

    @PostMapping("/expressAdd")
    public int expressAdd(@RequestBody ExpressList expressList){
        return expressListService.expressAdd(expressList);
    }

//    获取快递员详细信息
@GetMapping("/getDetialList")
public ExpressDetial getDetialList(@RequestParam("id") Long id)
{
    return expressListService.getDetialList(id);
}

@GetMapping("/getDetialListPhone")
public ExpressDetial getDetialListPhone(@RequestParam("phone") String phone)
{
    return expressListService.getDetialListPhone(phone);
}


//    获取快递员审核详细信息
@GetMapping("/getAuthDetialList")
public ExpressAuth getAuthDetialList(@RequestParam("id") Long id,@RequestParam("iid") Integer iid)
{
    return expressListService.getAuthDetialList(id,iid);
}
//修改快递员状态
    @PutMapping("/updateStatusFalse")
    public int updateStatusFalse(@RequestParam("id") Long id)
    {
        return expressListService.updateStatusFalse(id);
    }
    @PutMapping("/updateStatusTrue")
    public int updateStatusTrue(@RequestParam("id") Long id)
    {
        return expressListService.updateStatusTrue(id);
    }

//    快递员认证审核状态

    @PutMapping("/updateAuthTure")
    public int updateAuthTure(@RequestParam("id") Long id,@RequestParam("iid") Long iid,@RequestParam("authType")Integer authType)
    {
        return expressListService.updateAuthTure(iid,id,authType);
    }
    @PutMapping("/updateAuthFalse")
    public int updateAuthFalse(@RequestParam("id") Long id,@RequestParam("iid") Long iid,@RequestParam("authType")Integer authType)
    {
        return expressListService.updateAuthFalse(id,iid,authType);
    }

    //拒绝快递员认证
    @PostMapping ("/updateRefuseReason")
    public int updateRefuseReason(@RequestBody ExpressAuth expressAuth)
    {
        return expressListService.updateRefuseReason(expressAuth);
    }
    @PutMapping("/updateAccountStatusTrue")
    public int updateAccountStatusTrue(@RequestParam("id") Long id)
    {
        return expressListService.updateAccountStatusTrue(id);
    }
    @PutMapping("/updateAccountStatusFalse")
    public int updateAccountStatusFalse(@RequestParam("id") Long id)
    {
        return expressListService.updateAccountStatusFalse(id);
    }
    @PutMapping("/resetPassword")
    public int resetPassword(@RequestParam("id") Long id)
    {
        return expressListService.resetPassword(id);
    }

    @PutMapping("/sernullPayPassword")
    public int sernullPayPassword(@RequestParam("id") Long id)
    {
        return expressListService.sernullPayPassword(id);
    }


    @GetMapping("/getMember")
    public Member getMember()
    {
        return expressListService.getMember();
    }

    @GetMapping("/getNewAddNum")
    public Member getNewAddNum()
    {
        return expressListService.getNewAddNum();
    }
}
